<div id="slides">
  <%- @advertises.each do |adv| %>
		<%= image_tag adv.cover.url(:b) %>
	<% end %>
</div>
<br />
<div class='clearfix text-center'>
  <div id="connecting">
    WIFI免费上网服务正在开通中，<br />
    保持浏览器开启，<br />
    <p>【请稍候: <b id='countdown' style="color: blue;">10</b> S...】</p>
  </div>
  <!-- <div id="finish" style="padding-top: 3em; display: none;">
    开通成功！<br />
    欢迎使用WIFI免费上网服务
  </div> -->
	<!-- <div class="progress">
  	<div id='processbar' class="bar" style="width: 10%;"></div>
	</div> -->
</div>

<script>
  $(function(){
    $("#slides").slidesjs({
      width: 320,
      height: 280,
      play: {
      	auto: true,
      	interval: 3000
      },
      navigation: {
      	active: false
    	},
    	pagination: {
    		active: false
    	}
    });
    var timeout = 1000;
		var timer;
		// var process = 10;
		// timer = $.timer(timeout, function() {
		// 	process += 10;
		// 	if(process > 100){
		// 		timer.stop();
		// 		window.location.replace("/finish");
		// 	}
		// 	else{
    //         $('#processbar').width(process.toString()+'%');
		// 	}
		// });
    var countdown = 11;
    timer = $.timer(timeout, function() {
     countdown -= 1;
     if(countdown <= 0){
       timer.stop();
       // $('#connecting').css("display", "none");
       // $('#finish').css("display", "block");
       window.location.replace("/finish");
     }
     else {
        $('#countdown').text( countdown );
     }
    });

  });
</script>